﻿#ifndef ANPR_TH_H
#define ANPR_TH_H

#ifdef _WIN32
#include <Windows.h>
#endif
#include "opencv2/core/core.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui.hpp"
#include <log4cxx/logger.h>

#ifdef __linux__
typedef struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
} RECT;
#endif

#ifdef DLL_EXPORT
class _declspec(dllexport) ANPRTH
#else
class ANPRTH
#endif
{
public:
    ANPRTH();
    ~ANPRTH();

    // mode: 0: 图像识别, 1: 视频识别
    int Init(int mode = 0, int minPlateWidth = 80, int maxPlateWidth = 200, int maxImageWidth = 720, int maxImageHeight = 576, RECT *region = 0,
        bool doubleRowYellowLP = false, bool doubleRowPoliceLP = false, bool doubleRowArmyLP = false, bool embassyLP = false, bool tractorLP = false, bool airportLP = false,
        std::string province = "");

    std::string DetectLPNumber(IplImage* image);
    
private:
    unsigned char mem1[0x4000];        
    unsigned char mem2[100000000];
    
    bool error;
    bool enableRegion;
#ifdef _WIN32
    HANDLE mutex;
#endif
    log4cxx::LoggerPtr logger;
};

#endif
